<p id="btn" (click)="close()">
  <ion-icon name="arrow-back"></ion-icon>
  {{parentCom}}
</p>
<p style="padding-left: 24px;
      font-size: 16px;
      border-left: solid #0987fe;">基本信息
</p>

<!-- <form nz-form *ngIf="!loading"> -->
<div class="am-list-body">
  <InputItem name="code" [(ngModel)]="alarmStg['code']" [disabled]="option=='edit'" [clear]="true"
    [placeholder]="'请输入唯一编号'" [moneyKeyboardAlign]="'left'" [error]="codeRequired"
    (onErrorClick)="inputErrorClick('策略编号',$event)" (onChange)="inputChange('策略编号', $event)"><span
      style="color: red">*</span>策略编号
  </InputItem>
</div>
<div class="am-list-body">
  <InputItem name="name" [(ngModel)]="alarmStg['name']" [clear]="true" [placeholder]="'请输入策略名称'" [error]="nameRequired"
    (onErrorClick)="inputErrorClick('策略名称',$event)" (onChange)="inputChange('策略名称', $event)"
    [moneyKeyboardAlign]="'left'"><span style="color: red">*</span>策略名称
  </InputItem>
</div>
<div class="am-list-body">
  <ion-item>
    <ion-label>设备</ion-label>
    <ion-select name="device" placeholder="选择设备" [(ngModel)]="alarmStg['device']" (compareWith)="compareFn" ok-text="确认"
      cancel-text="取消">
      <ion-select-option [value]="item" *ngFor="let item of deviceList">{{item.name}}</ion-select-option>
    </ion-select>
  </ion-item>
</div>
<div class="am-list-body" *ngIf="alarmStg.device">
  <ion-item>
    <ion-label>设备属性</ion-label>
    <ion-select name="attribute" placeholder="选择设备属性" [(ngModel)]="alarmStg.attribute" (compareWith)="compareFn"
      ok-text="确认" cancel-text="取消">
      <ion-select-option [value]="item" *ngFor="let item of alarmStg.device.attrs">{{item.name}}</ion-select-option>
    </ion-select>
  </ion-item>
</div>

<div class="am-list-body">
  <ion-item>
    <ion-label>报警条件A</ion-label>
    <ion-select style="display: -webkit-inline-box" placeholder="选择条件A" [(ngModel)]="alarmStg['conditiona']['key']"
      ok-text="确认" cancel-text="取消">
      <ion-select-option value=">">大于A</ion-select-option>
      <ion-select-option value=">=">大于等于A</ion-select-option>
      <ion-select-option value="<">小于A</ion-select-option>
      <ion-select-option value="<=">小于等于A</ion-select-option>
      <ion-select-option value="=">等于A</ion-select-option>
      <ion-select-option value="!=">不等于A</ion-select-option>
    </ion-select>
    <ion-input name="optionA" placeholder="A的值" style="text-align: right" [(ngModel)]="alarmStg['conditiona']['value']">
    </ion-input>
  </ion-item>
</div>
<!-- <InputItem style="width: 25%; display:inline-block;" [placeholder]="'A的值'"></InputItem> -->

<div class="am-list-body">
  <ion-item>
    <ion-label>报警条件B</ion-label>
    <ion-select style="display: -webkit-inline-box" placeholder="选择条件B" [(ngModel)]="alarmStg['conditionb']['key']"
      ok-text="确认" cancel-text="取消">
      <ion-select-option value="<">小于B</ion-select-option>
      <ion-select-option value=">">大于B</ion-select-option>
      <ion-select-option value="<=">小于等于B</ion-select-option>
      <ion-select-option value=">=">大于等于B</ion-select-option>
    </ion-select>
    <ion-input name="optionB" placeholder="B的值" style="text-align: right" [(ngModel)]="alarmStg['conditionb']['value']">
    </ion-input>
  </ion-item>
</div>
<!-- <InputItem style="width: 25%; display:inline-block;" [placeholder]="'B的值'"></InputItem> -->

<div class="am-list-body">
  <ion-item>
    <ion-label style="display: contents">报警级别</ion-label>
    <ion-select placeholder="选择级别" [(ngModel)]="alarmStg['level']" ok-text="确认" cancel-text="取消">
      <ion-select-option value="0">提醒</ion-select-option>
      <ion-select-option value="1">警报</ion-select-option>
      <ion-select-option value="2">严重</ion-select-option>
    </ion-select>
  </ion-item>
</div>
<div class="am-list-body" id="ms">
  <InputItem [type]="'money'" [clear]="true" [placeholder]="'请输入毫秒值'" [focus]="numberFocus"
    [(ngModel)]="alarmStg['interval']">
    时间间隔(ms)</InputItem>
</div>
<div class="am-list-body">
  <ListItem multipleLine [extra]="on">
    启用禁用
  </ListItem>
  <ng-template #on>
    <Switch [checked]="true" [(ngModel)]="alarmStg.status">
    </Switch>
  </ng-template>
</div>

<div class="am-list-body">
  <InputItem name="zs" [(ngModel)]="alarmStg['note']" [clear]="true" [placeholder]="'注释'" [moneyKeyboardAlign]="'left'">
    注释
  </InputItem>
</div>

<!-- </form> -->

<div style="margin: 24px; display: flex;">
  <div Button [size]="'small'" [type]="'primary'" style="margin-right: 8px;width: 95px" (click)="submit()">提交</div>
  <div Button [size]="'small'" style="width: 95px;margin-right: 8px">重置</div>
  <div Button [size]="'small'" style="width: 94px;" (click)="close()">取消</div>
</div>